package com.zelin.manager.controller;

import com.zelin.manager.entity.ContentEntity;
import com.zelin.manager.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * 作用：
 * 作者：LZB
 * 类名：PortalController
 * 时间：2021/11/16  10:54
 */
@Controller
public class PortalController {

    @Autowired
    private ContentService contentService;

    //1.1 查询所有的广告列表
    @GetMapping({"/","/index.html"})
    public String index(Model model){
        //1.1 查询所有的广告
        List<ContentEntity> list = contentService.findAll();
        //1.2 将广告列表放入model中
        model.addAttribute("list",list);
        //1.3 返回逻辑视图
        return "index";
    }

}
